﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Gammar.Digger.BLL;
using System.Collections.Generic;
public partial class Common_UserControls_WebSiteCategoryDDL : System.Web.UI.UserControl
{
    public string BindKey { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
       

        if (!IsPostBack)
        {
            Dictionary<string,string> dict=WebSiteManagement.GetAllWebSiteCategory();
            DropDownList1.DataSource = dict;
            DropDownList1.DataTextField = "Value";
            DropDownList1.DataValueField = "key";
            DropDownList1.DataBind();

            if (!string.IsNullOrEmpty(BindKey))
            {
                ListItem item = DropDownList1.Items.FindByValue(BindKey);
                if (item!=null)
                {
                    item.Selected = true;
                }
                else
                {
                    DropDownList1.Items[0].Selected = true;
                }
            }
            else
            {
                DropDownList1.Items[0].Selected = true;
            }
        }
    }
}
